load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "bindinfo",
    srcs = [
        "bind_cache.go",
        "bind_record.go",
        "handle.go",
        "session_handle.go",
        "stat.go",
    ],
    importpath = "github.com/pingcap/tidb/bindinfo",
    visibility = ["//visibility:public"],
    deps = [
        "//kv",
        "//metrics",
        "//parser",
        "//parser/ast",
        "//parser/format",
        "//parser/mysql",
        "//parser/terror",
        "//sessionctx",
        "//sessionctx/sessionstates",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//types",
        "//types/parser_driver",
        "//util/chunk",
        "//util/hack",
        "//util/hint",
        "//util/kvcache",
        "//util/logutil",
        "//util/mathutil",
        "//util/memory",
        "//util/parser",
        "//util/sqlexec",
        "//util/stmtsummary/v2:stmtsummary",
        "//util/table-filter",
        "//util/timeutil",
        "@org_golang_x_exp//maps",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "bindinfo_test",
    timeout = "moderate",
    srcs = [
        "bind_cache_test.go",
        "capture_test.go",
        "handle_test.go",
        "main_test.go",
        "optimize_test.go",
        "session_handle_test.go",
        "temptable_test.go",
    ],
    embed = [":bindinfo"],
    flaky = True,
    race = "on",
    shard_count = 45,
    deps = [
        "//bindinfo/internal",
        "//config",
        "//domain",
        "//errno",
        "//metrics",
        "//parser",
        "//parser/auth",
        "//parser/model",
        "//server",
        "//sessionctx/variable",
        "//testkit",
        "//testkit/testsetup",
        "//util/hack",
        "//util/parser",
        "//util/stmtsummary",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_prometheus_client_model//go",
        "@com_github_stretchr_testify//require",
        "@io_opencensus_go//stats/view",
        "@org_uber_go_goleak//:goleak",
    ],
)
